#选择排序             横向输出
array = [8,2,6,3,4,5,7,1,10,9]
L=len(array)
for i in range(1,L):
    temp = array[i]
    array.remove(array[i])
    for j in range(i):
        if array[j]>temp:
            array.insert(j,temp)
            break
    else:
        array.insert(i,temp)
print(array)


#选择排序
def select_sort(arr):
    l = len(arr)
    for i in range(l - 1):
        min_index = i
        for j in range(i + 1, l):
            if arr[j] < arr[min_index]:
                min_index = j
        arr[i], arr[min_index] = arr[min_index], arr[i]
    return arr
    
print(select_sort([5,5,5,2,3,8,1]))
